
#include "page_fetcher.h"

#include <cstdio>
#include <string>
using std::string;

int main()
{
  string res1;
  string res2;
  PageFetcher pf1;
  PageFetcher pf2;
  FILE *f1 = fopen("baidu.html", "w");
  FILE *f2 = fopen("163.html", "w");
  if(pf1.Fetch("http://www.baidu.com", &res1))
  {
    sleep(5);
    fprintf(f1, "%s", res1.c_str());
  }else
  {
    printf("1 error\n");
  }
  printf("1 finished\n");
  if(pf2.Fetch("http://www.163.com", &res2))
  {
    sleep(5);
    fprintf(f2, "%s", res2.c_str());
  }else
  {
    printf("2 error\n");
  }
  printf("2 finished\n");
  //sleep(20);
  fclose(f1);
  fclose(f2);
  return 0;
}
